package main

import (
	grpc2 "google.golang.org/grpc"
	"month_zh5/common/consul"
	"month_zh5/common/grpc"
	"month_zh5/common/model/es"
	"month_zh5/common/model/mysql"
	"month_zh5/common/nacos"
	"month_zh5/common/viper_config"
	"month_zh5/service/goods"
)

func main() {
	config := viper_config.ViperConfig("server", "./config", "Nacos")
	nacos.NewNaCos(config["ipaddr"], config["dataid"], config["group"])
	nac := nacos.NacosConfig
	mysql.InitMysql()
	es.InitEs()
	consul.RegisterConsul(nac.Consul.Host, nac.Consul.Port, nac.Grpc.Host, nac.Grpc.Port, nac.Consul.Name)
	grpc.RegisterGrpc(nac.Grpc.Host, nac.Grpc.Port, func(server *grpc2.Server) {
		goods.Register(server)
	})
}
